//
//  GSubSection.m
//  helpinrain
//
//  Created by Gang.Wang on 12-7-26.
//  Copyright (c) 2012年 Zhuhai Yuike Technology Co., Ltd. All rights reserved.
//

#import "GSubSection.h"
#import "mcf.h"
#import "GStepXmlModel.h"

@implementation GSubSection

@synthesize steps = steps_;

- (void) dealloc
{
    YRelease(steps_)
    [super dealloc];
}


- (id) initWithXmlTree:(XMLParsedTree *)tree
{
    self = [super initWithXmlTree:tree];
    if (self) {
        self.name = [self.xmlTree attributeValueOfName:@"name" atPath:@"subsection"];
        self.description = [self.xmlTree attributeValueOfName:@"description" atPath:@"subsection"];
        
        NSMutableArray * temp_step_ = [[NSMutableArray alloc] initWithCapacity:3];
        for (XMLParsedTree * node in [self.xmlTree childrenTreeAtPath:@"subsection" nodeName:@"step"]) 
        {
            GStepXmlModel * step = [[GStepXmlModel alloc] initWithXmlTree:node];
            [temp_step_ addObject:step];
            YRelease(step)
        }
        
        self.steps = temp_step_;
        YRelease(temp_step_)
    }
    return self;
}

@end
